#初始化参数信息
HaProxyPath="/usr/local/haproxy"

echo "HaProxy部署路径:"${HaProxyPath}

#将HaProxy进程Kill掉
kill -9 `ps -ef | grep ${HaProxyPath}|awk '{print $2}'`
echo "HaProxy进程已完成Kill..."

#静默方式启动HaProxy
cd $HaProxyPath/sbin
#nohup /usr/local/haproxy/sbin/haproxy -f /usr/local/haproxy/conf/haproxy.cfg  > haproxy.log 2>&1 &
nohup haproxy -f $HaProxyPath/conf/haproxy.cfg  > haproxy.log 2>&1 &

echo "HaProxy启动完成,等待输出日志..."

#检查启动日志是否输出,输出后Tail方式打开
sleep 3s
tail -F haproxy.log
